<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="../header.jsp"%>
<!--  显示内容 -->
	<!-- Content Wrapper. Contains page content -->
      <div class="content-wrapper" style="font-family: '微软雅黑';">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            ${module}
            <small>经纪人详情</small>
          </h1>
          <ol class="breadcrumb">
            <li><a href='<c:url value="/main/stage/main"/>'><i class="fa fa-dashboard"></i>主页</a></li>
            <li class="active">未认证经纪人列表</li>
          </ol>
        </section>
        
        <!-- Main content -->
        <section class="content">
          <div class="row">
            <div class="col-xs-12">
              <div class="box" style="min-width: 920px;">
                <div class="box-header" style="padding: 20px;">
                  <img style="float: left;margin-left:30px; height: 70px;width: 70px;" alt="经纪人头像" src="${broker.headerpath}@70w">
                  <div style="float: left;margin-left: 10px;padding-top: 2px;">
	                  <span style="font-size: 20px;">${broker.username}</span>
	                  <span style="color: gray;">经纪人</span><br/>
	                  <span>${broker.telephone}</span><br/>
	                  <img style="width: 16px;height: 16px;margin-top: -5px;" alt="等级" src="http://static.image.alimmdn.com/broker/level/level.png?t=1442986942000"/>
	                  <span style="color: #41b03e;">${broker.level}</span>
                  </div>
                  <div style="clear: both;"></div>
                  <hr/>
                  <div class="col-xs-12">
                  	<div class="col-xs-6" style="text-align: center;">
                  		<span>是否通过培训：</span>
               			<c:choose>
               				<c:when test="${broker.isTrained eq 1}">
               					<span style="color: green;">是</span>
               				</c:when>
               				<c:otherwise>
               					<span style="color: red;">否</span>
               				</c:otherwise>
               			</c:choose>
                  	</div>
                  	<div class="col-xs-6"  style="text-align: center;">
                  		<span>是否通过测试：</span>
                  		<c:choose>
               				<c:when test="${broker.isTested eq 1}">
               					<span style="color: green;">是</span>
               				</c:when>
               				<c:otherwise>
               					<span style="color: red;">否</span>
               				</c:otherwise>
               			</c:choose>
                  	</div>
                  </div>
                  <div style="clear: both;"></div>
                  <hr/>
                  <div class="col-xs-12">
                  	<div class="col-xs-6" style="text-align: center;">
                  		<span>审核真实姓名：</span>
                  		<span style="color: green">${broker.realName}</span>
                  	</div>
                  	<div class="col-xs-6" style="text-align: center;">
                  		<span>审核手机号：</span>
                  		<span style="color: green">${broker.authenTel}</span>
                  	</div>
                  </div>
                  <div style="clear: both;"></div>
                  <hr/>
                  <div class="col-xs-12">
                  	<div class="col-xs-6" style="text-align: center;">
                  		<span>身份证号：</span>
                  		<span style="color: green">${broker.idNum}</span>
                  	</div>
                  	<div class="col-xs-6" style="text-align: center;">
                  	</div>
                  </div>
                  <div style="clear: both;"></div>
                  <hr/>
                  <div class="col-xs-12">
                  	<div class="col-xs-3" style="text-align: center;">
                  		身份证正面照
                  		<div style="margin-top: 10px;" id="images">
	                  		<a id="positiveIdPath" title="身份证正面照" href="${broker.positiveIdPath}@900w" data-lightbox="example-1">
		                  		<img class="pic" style="width: 257px;height: 162px;" alt="身份证正面照" src="${broker.positiveIdPath}">
	                  		</a>
                  		</div>
                  	</div>
                  	<div class="col-xs-1"></div>
                  	<div class="col-xs-3" style="text-align: center;">
                  		身份证反面照
                  		<div style="margin-top: 10px;" id="images">
                  			<a id="negativeIdPath" title="身份证反面照" href="${broker.negativeIdPath}@900w" data-lightbox="example-2">
		                  		<img class="pic" style="width: 257px;height: 162px;" alt="身份证反面照" src="${broker.negativeIdPath}">
                  			</a>
                  		</div>
                  	</div>
                  	<div class="col-xs-1"></div>
                  	<div class="col-xs-3" style="text-align: center;">
                  		手持身份证照
                  		<div style="margin-top: 10px;" id="images">
                  			<a id="handIdPath" title="手持身份证照" href="${broker.handIdPath}@900w" data-lightbox="example-3">
		                  		<img class="pic" style="width: 257px;height: 162px;" alt="手持身份证照" src="${broker.handIdPath}">
                  			</a>
                  		</div>
                  	</div>
                  </div>
                  <div style="clear: both;"></div>
                  <hr/>
                  <div style="text-align: center;margin-top: 50px;">
                  	<c:choose>
                  		<c:when test="${broker.isAuthen eq 1}">
                  			<button class="btn btn-success" style="width: 100px;" onclick="pass(${broker.popid})">通过</button>
                  			<button class="btn btn-success" style="width: 100px;" onclick="refuse(${broker.popid})">拒绝</button>
                  		</c:when>
                  		<c:otherwise>
                  			<button class="btn btn-success" style="width: 100px;" onclick="pass(${broker.popid})" disabled="disabled">通过</button>
                  			<button class="btn btn-success" style="width: 100px;" onclick="refuse(${broker.popid})" disabled="disabled">拒绝</button>
                  		</c:otherwise>
                  	</c:choose>
                  </div>
                </div><!-- /.box-header -->
              </div><!-- /.box -->
            </div><!-- /.col -->
          </div><!-- /.row -->
          
          <!--  显示下面的分页控件  -->
          
        </section><!-- /.content -->
        
       </div>
      <jsp:include page="../js.jsp"/>
	<%@ include file="../footer.jsp"%>
	<script type="text/javascript">
		$(document).ready(function() {
			/* $("#positiveIdPath, #negativeIdPath,#handIdPath").imgbox({
				'speedIn'		: 0,
				'speedOut'		: 0,
				'alignment'		: 'center',
				'overlayShow'	: true,
				'allowMultiple'	: false
			}); */
			var carrousel = $( ".carrousel" );

			$( ".portrait" ).click( function(e){
			  var src = $(this).find(".pic").attr( "data-src-wide" );
			  carrousel.find("img").attr( "src", src );
			  carrousel.fadeIn( 200 );
			});

			carrousel.find( ".close" ).click( function(e){
			  carrousel.find( "img" ).attr( "src", '' );
			  carrousel.fadeOut( 200 );
			} );
		});
		
		
		function pass(brokerid){
			$.post('<c:url value="/broker/authen/pass"/>',{"brokerid":brokerid},function(data){
				if(data.code==0){
					swal({
						title:"操作成功！",
						type:"success",
						closeOnConfirm: true,
						confirmButtonText:"确  定"
					},
					function (){
						window.location.href='<c:url value="/broker/unauthen/list"/>'; 
					});
				}else{
					swal({
						title:"操作失败！",
						type:"error",
						closeOnConfirm: true,
						confirmButtonText:"确  定"
					});
				}
			},"json");
		}
		
		function refuse(brokerid){
			swal({   
				title: "拒绝通过!",   
				text: "请填写拒绝原因:",   
				type: "input",   
				showCancelButton: true,   
				closeOnConfirm: false,   
				animation: "slide-from-top",   
				inputPlaceholder: "填写原因" }, 
				function(inputValue){   
					if (inputValue === false) 
						return false;      
					if (inputValue === "") {     
						swal.showInputError("请填写拒绝原因!");     
						return false   
					}      
					$.post('<c:url value="/broker/authen/refuse"/>',{"brokerid":brokerid,"reason":inputValue},function(data){
						if(data.code==0){
							swal({
								title:"操作成功！",
								type:"success",
								closeOnConfirm: true,
								confirmButtonText:"确  定"
							},
							function (){
								window.location.href='<c:url value="/broker/unauthen/list"/>'; 
							});
						}else{
							swal({
								title:"操作失败！",
								type:"error",
								closeOnConfirm: true,
								confirmButtonText:"确  定"
							});
						}
					},"json");
				});
		}
	</script>
	</body>
</html>